home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / pdcurs21 / private / _scroll.c < prev    next >
C/C++ Source or Header  |  1993-06-18  |  3KB  |  139 lines

  1. #define    CURSES_LIBRARY    1
  2. #include <curses.h>
  3.  
  4. #ifdef PDCDEBUG
  5. char *rcsid__scroll = "$Header: C:\CURSES\private\RCS\_scroll.c 2.1 1993/06/18 20:23:40 MH Rel MH $";
  6. #endif
  7.  
  8.  
  9.  
  10.  
  11. /*man-start*********************************************************************
  12.  
  13.   PDC_scroll()    - low level screen scroll
  14.  
  15.   PDCurses Description:
  16.      Scrolls a window in the current page up or down. Urow, lcol,
  17.      lrow, rcol are the window coordinates.    Lines is the number of
  18.      lines to scroll. If 0, clears the window, if < 0 scrolls down,
  19.      if > 0 scrolls up.  Blanks areas that are left, and sets
  20.      character attributes to attr. If in a colour graphics mode,
  21.      fills them with the colour 'attr' instead.
  22.  
  23.   PDCurses Return Value:
  24.      The PDC_scroll() function returns OK on success otherwise ERR is returned.
  25.  
  26.   PDCurses Errors:
  27.      An error will only be returned on the Flexos platform if s_copy()
  28.      fails.
  29.  
  30.   Portability:
  31.      PDCurses    int PDC_scroll( int urow, int lcol, int rcol,
  32.                       int nlines, chtype attr );
  33.  
  34. **man-end**********************************************************************/
  35.  
  36. int    PDC_scroll(int urow, int lcol, int lrow, int rcol, int nlines, chtype attr)
  37. {
  38. #ifdef    FLEXOS
  39.     int    srow;
  40.     int    scol;
  41.     int    drow;
  42.     int    dcol;
  43.     int    nrows
  44.     int    ncols;
  45.     char    blank = (char) _cursvar.blank;
  46. #endif
  47.  
  48. #ifdef    OS2
  49.     USHORT ch=((attr << 8) & _cursvar.blank);
  50. #endif
  51.  
  52. #ifdef PDCDEBUG
  53.     if (trace_on) PDC_debug("PDC_scroll() - called: urow %d lcol %d lrow %d rcol %d nlines %d\n",urow,lcol,lrow,rcol,nlines);
  54. #endif
  55.  
  56. #ifdef    FLEXOS
  57.     if (nlines == 0)
  58.     {
  59.         sframe.fr_pl[0] = (UBYTE *) & blank;
  60.         sframe.fr_pl[1] = (UBYTE *) & attr;
  61.         sframe.fr_pl[2] = (UBYTE *) " ";
  62.         sframe.fr_nrow = 1;
  63.         sframe.fr_ncol = 1;
  64.         sframe.fr_use = 0x00;
  65.         nrows = lrow;
  66.         ncols = rcol;
  67.         srow = drow = 0;
  68.         scol = dcol = 0;
  69.     }
  70.     else
  71.     if (nlines < 0)
  72.     {
  73.         srow = urow;
  74.         scol = lcol;
  75.         drow = lrow;
  76.         dcol = rcol;
  77.     }
  78.     else
  79.     if (nlines > 0)
  80.     {
  81.         srow = urow;
  82.         scol = lcol;
  83.         drow = lrow;
  84.         dcol = lcol;
  85.     }
  86.  
  87.     drect.r_row = drow;
  88.     drect.r_col = dcol;
  89.     drect.r_nrow = nrows;
  90.     drect.r_ncol = ncols;
  91.  
  92.     srect.r_col = scol;
  93.     srect.r_row = srow;
  94.     srect.r_nrow = nrows;
  95.     srect.r_ncol = ncols;
  96.  
  97.     if (nlines != 0)
  98.         retcode = s_copy(0x03, 0x01L, 0L, (far unsigned short *) &drect, 0L, (far unsigned short *) &srect);
  99.     else
  100.         retcode = s_copy(0x03, 0x01L, 0L, (far unsigned short *) &drect, (far unsigned short *) &sframe, (far unsigned short *) &srect);
  101.     return( (retcode < 0L) ? ERR : OK );
  102. #endif
  103.  
  104. #ifdef    DOS
  105.     if (nlines >= 0)
  106.     {
  107.         regs.h.ah = 0x06;
  108.         regs.h.al = (unsigned char) nlines;
  109.     }
  110.     else
  111.     {
  112.         regs.h.ah = 0x07;
  113.         regs.h.al = (unsigned char) (-nlines);
  114.     }
  115.     regs.h.bh = (unsigned char)((attr & A_ATTRIBUTES) >> 8);
  116.     regs.h.ch = (unsigned char) urow;
  117.     regs.h.cl = (unsigned char) lcol;
  118.     regs.h.dh = (unsigned char) lrow;
  119.     regs.h.dl = (unsigned char) rcol;
  120.     int86(0x10, ®s, ®s);
  121.     return( OK );
  122. #endif
  123.  
  124. #ifdef    OS2
  125.     if (nlines > 0)
  126.         VioScrollUp(urow, lcol, lrow, rcol, nlines, (PBYTE)&ch, 0);
  127.     else
  128.         if (nlines < 0)
  129.             VioScrollDn(urow, lcol, lrow, rcol, nlines, (PBYTE)&ch, 0);
  130.         else
  131. /* this clears the whole screen */
  132.             VioScrollUp(0, 0, -1, -1, -1, (PBYTE)&ch, 0);
  133. #endif
  134.  
  135. #ifdef UNIX
  136. /* INCOMPLETE */
  137. #endif
  138. }
  139.